home *** CD-ROM | disk | FTP | other *** search
/ BBS Toolkit / BBS Toolkit.iso / qbbs / msgcheck.zip / MSGCHECK.C < prev    next >
C/C++ Source or Header  |  1989-12-09  |  2KB  |  59 lines

  1. /*  MSGCHECK, a utility for QuickBBS users.  MSGCHECK sets the DOS
  2.         ERRORLEVEL to 1 if the message base needs to be renumbered.  The
  3.         upper limit for the number of allowed messages is entered on the
  4.         command line.  If the message base does not need to be renumbered,
  5.         ERRORLEVEL is set to 0.  MSGCHECK always exits with ERRORLEVEL set
  6.         to 1 if the high message number is 32000 or more.
  7.  
  8.         This utility was written by David L. Emory, FidoNet 1:105/360
  9. */
  10.  
  11.  
  12. #include <stdio.h>
  13.  
  14. main(argc,argv)
  15.  
  16.         int argc;
  17.         char *argv[];
  18. {
  19.         int limit;
  20.  
  21.         struct
  22.                 {
  23.                 int lowmsg,highmsg,totalactive,active[199];
  24.                 } msgrecord;
  25.  
  26.         FILE *fptr;
  27.         int recno;
  28.         if((fptr=fopen("msginfo.bbs","rb"))==NULL)
  29.                 {
  30.                 printf("Can't open msginfo.bbs.\n");
  31.                 printf("Run MSGCHECK in the QuickBBS subdirectory.\n");
  32.                 exit(0);
  33.                 }
  34.         if (argc < 2)
  35.                 {
  36.                 printf("Syntax:  MSGCHECK <Limit>\n");
  37.                 printf("Run MSGCHECK in the QuickBBS subdirectory.\n");
  38.                 exit(0);
  39.                 }
  40.  
  41.         limit = atoi(argv[1]);
  42.         fread(&msgrecord,sizeof(msgrecord),1,fptr);
  43.         printf("High Message Limit: %d\t\t",limit);
  44.         printf("High Message Number: %d\n",msgrecord.highmsg);
  45.         fclose(fptr);
  46.  
  47.         if ((limit < msgrecord.highmsg) | (32000 < msgrecord.highmsg))
  48.                 {
  49.                 printf("Message base needs to be renumbered.\n");
  50.                 printf("Setting ErrorLevel to 1.\n");
  51.                 exit(1);
  52.                 }
  53.         printf("Message base does not need to be renumbered.\n");
  54.         printf("Setting Errorlevel to 0.\n");
  55.         exit(0);
  56. }
  57.  
  58.  
  59.